package com.sicheng.lc.周赛.分类.哈西表or计数or滑动窗口or双指针.双指针;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/7/24 21:56
 */
public class 全0子数组的数目 {
    //https://leetcode.cn/problems/number-of-zero-filled-subarrays/
    public long zeroFilledSubarray(int[] nums) {
        int l = 0;
        long res = 0;
        for (int r = 0; r < nums.length; r++) {
            while (l <= r && nums[r] != 0) {
                l++;
            }
            res += r - l + 1;
        }
        return res;
    }
}
